package com.jp.kefu.web.controller;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by Administrator on 2017/7/25.
 */
@ControllerAdvice
public class ExceptionController {
    @ExceptionHandler(RuntimeException.class)
    @ResponseBody
    public ResponseEntity runtimeException(RuntimeException e){


        return ResponseEntity.unprocessableEntity().body(e.getCause().getMessage());
    }

}
